#include <iostream>
using namespace std;

// Student类如下：
class Student 
{
public:
    void Set_StuNum(int n) { _stu_num = n; }
    void Set_Score(float n) { _score = n; }

    int Get_StudNum() const { return _stu_num; }
    float Get_Score() const { return _score; }
    friend void Score_Trans(const Student& s);
private:
    int _stu_num; //学号
    float _score; //分数   
};

void Score_Trans(const Student& s)
{
    cout << s.Get_StudNum() << ' ';
    if (s.Get_Score() >= 90) cout << "优";
    else if (s.Get_Score() >= 80) cout << "良";
    else if (s.Get_Score() >= 70) cout << "中";
    else if (s.Get_Score() >= 60) cout << "及格";
    else cout << "不及格";
}

// 要求使用以下main函数测试：
int main() 
{
    int n, i, stu_num, max_stu_num;
    float score, max_score;
    cin >> n;
    Student* stu = new Student[n];
    for (i = 0; i < n; i++) 
    {
        cin >> stu_num >> score;
        stu[i].Set_StuNum(stu_num);
        stu[i].Set_Score(score);
    }

    for (i = 0; i < n; i++) 
    {
        Score_Trans(stu[i]);
        if (i < n - 1) cout << endl;
    }

    return 0;
}
